<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
test(() => assert_selection(
  '<div contenteditable>|</div>',
  selection => {
    selection.document.execCommand('insertParagraph');
    selection.document.execCommand('insertUnorderedList');
  },
  [
    '<div contenteditable>',
      '<div><br></div><div><ul><li>|<br></li></ul></div>',
     '</div>',
  ]),
  '1 insertUnorderedList should not hang with empty paragraph');

test(() => assert_selection(
  [
    '<div contenteditable>',
      '<blockquote>^foo</blockquote>',
      '<blockquote>bar</blockquote>',
      '<blockquote><br></blockquote>',
      '<blockquote><br></blockquote>',
      '<blockquote><br>|</blockquote>',
    '</div>',
  ],
  'insertUnorderedList',
  [
    '<div contenteditable>',
      '<blockquote><ul>',
        '<li>^foo</li>',
        '<li>bar</li>',
        '<li><br></li>',
        '<li>|<br></li>',
       '</ul></blockquote>',
       '<blockquote><br></blockquote>',
     '</div>',
  ]),
  '2 insertUnorderedList should not hang with blockquote');
</script>
